<?xml version='1.0' encoding='UTF-8' ?>
        <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-14T10:15:01'>
        <xsl:output method='xml' standalone='yes' />
        <xsl:template match='my:myFields'>
        <DynamicEntity Name='csp_citizenfeedback' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
        xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
        <Properties xmlns='http://schemas.microsoft.com/crm/2006/WebServices'>

			
					<xsl:if test='//my:CitizenAddress/text()'>
						<Property xsi:type='StringProperty' Name='csp_address'>
							<Value><xsl:value-of select='//my:CitizenAddress'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenCity/text()'>
						<Property xsi:type='StringProperty' Name='csp_city'>
							<Value><xsl:value-of select='//my:CitizenCity'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenZip/text()'>
						<Property xsi:type='StringProperty' Name='csp_postalcode'>
							<Value><xsl:value-of select='//my:CitizenZip'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenEmail/text()'>
						<Property xsi:type='StringProperty' Name='csp_emailaddress'>
							<Value><xsl:value-of select='//my:CitizenEmail'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenPhone/text()'>
						<Property xsi:type='StringProperty' Name='csp_phone'>
							<Value><xsl:value-of select='//my:CitizenPhone'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenFax/text()'>
						<Property xsi:type='StringProperty' Name='csp_fax'>
							<Value><xsl:value-of select='//my:CitizenFax'/></Value>
						</Property>
					</xsl:if>
					<xsl:if test='//my:FeedbackDescription/text()'>
        <Property xsi:type='StringProperty' Name='csp_description'>
          <Value><xsl:value-of select='//my:FeedbackDescription'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:LocationEndDate/text()'>
        <Property xsi:type='CrmDateTimeProperty' Name='csp_enddatetime'>
          <Value><xsl:value-of select='//my:LocationEndDate'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:LocationAddress/text()'>
        <Property xsi:type='StringProperty' Name='csp_feedbackaddress'>
          <Value><xsl:value-of select='//my:LocationAddress'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:LocationCity/text()'>
        <Property xsi:type='StringProperty' Name='csp_feedbackcity'>
          <Value><xsl:value-of select='//my:LocationCity'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:LocationZIP/text()'>
        <Property xsi:type='StringProperty' Name='csp_feedbackpostalcode'>
          <Value><xsl:value-of select='//my:LocationZIP'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:LocationStartDate/text()'>
        <Property xsi:type='CrmDateTimeProperty' Name='csp_startdatetime'>
          <Value><xsl:value-of select='//my:LocationStartDate'/></Value>
        </Property>
        </xsl:if>


				<xsl:if test='//my:FeedbackType/text()'>
					<Property xsi:type='PicklistProperty' Name='csp_type'>
					<xsl:choose>
					<xsl:when test="//my:FeedbackType='Benefits Payments'"><Value>1</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Community Safety'"><Value>2</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Council Property'"><Value>3</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Entertainment, Halls, and Catering'"><Value>4</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Environmental Health'"><Value>5</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Freedom of Information'"><Value>6</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Housing Services'"><Value>7</Value></xsl:when>				
					<xsl:when test="//my:FeedbackType='Leisure Services'"><Value>8</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Local Markets'"><Value>9</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Trading Standards'"><Value>10</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Transport Services'"><Value>11</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='LRG Performance and Standards'"><Value>12</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Parks, Recreation, and Playgrounds'"><Value>13</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Roads and Pavements'"><Value>14</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Rubbish and Graffiti'"><Value>15</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Schools and Nurseries'"><Value>16</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Street Lighting'"><Value>17</Value></xsl:when>
					<xsl:when test="//my:FeedbackType='Utilities'"><Value>18</Value></xsl:when>
					<xsl:otherwise><Value>100</Value></xsl:otherwise>
					</xsl:choose>
					</Property>
				</xsl:if>
					
					
				</Properties>
		</DynamicEntity>
					
</xsl:template>
</xsl:stylesheet>
